/** 检验码计算（异或）
 * @name: Get_Bcc
 * @param {uint8_t} *data 需要计算的数据
 * @param {uint16_t} length 长度
 * @returns {uint_8} 检验码
 */
uint8_t Get_Bcc(uint8_t *data, uint16_t length)
{
    uint8_t i;
    uint8_t bcc = 0; // Initial value

    for (i = 0; i < length; i++)
    {
        bcc ^= data[i]; 
    }

    return bcc;
}


//测试
int main()
{
    uint8_t data[] = {0x52, 0x23, 0x85, 0x26, 0x55, 0x36};
    uint8_t a = Get_Bcc(data, 6);
    printf("%02x\n", a);
    return 0;
}

/*结果为 0xb1*/